package com.movitech.mobile.cz.base.common.util;
import com.movitech.mobile.cz.base.common.license.LicenseUtil;

import java.util.Random;

public class TokenUntil {

	public static String getToken() {
		LicenseUtil.INSTANCE.validate();
		String s = DateUtils.getNow().getTime() + "";
		String ss = getRandNum(10) + s + getRandNum(22 - s.length());
		return ss;
	}

	public static String getRandNum(int n) {
		char[] rand = new char[n];
		String str = "123456789qwertyuipkjhgfdsaxcvbnmQWERTYUIPLKJHGFDSAXCVBNM";
		for (int i = 0; i < n; i++) {
			Random rd = new Random();
			int index = rd.nextInt(str.length());
			rand[i] = str.charAt(index);
		}
		return new String(rand);
	}

	public static String getRandNum2(int n) {
		char[] rand = new char[n];
		String str = "1234567890";
		for (int i = 0; i < n; i++) {
			Random rd = new Random();
			int index = rd.nextInt(str.length());
			rand[i] = str.charAt(index);
		}
		return new String(rand);
	}
}
